@model OrderDetailsModel
@inject IWebHelper webHelper
@inject SeoSettings seoSettings
@using Grand.Framework.Themes
@using Grand.Framework.UI
@inject IWorkContext workContext
@inject IThemeContext themeContext
@inject IPageHeadBuilder pagebuilder
@{
    if (!Model.PrintMode)
    {
        Layout = "_ColumnsOne";
        var themeName = themeContext.WorkingThemeName;
        pagebuilder.AppendCssFileParts(ResourceLocation.Head, string.Format("~/Themes/{0}/Content/css/cart/cart.css", themeName));
    }
    else
    {
        Layout = "_Print";
    }
    //title
    pagebuilder.AddTitleParts(T("PageTitle.OrderDetails").Text);
}
@if (Model.PrintMode)
{
    <script asp-location="Footer">
        window.print();
    </script>
}
<div class="page order-details-page mb-3">
    @if (!Model.PrintMode)
    {
        <h1 class="generalTitle h2">@T("Order.OrderInformation")</h1>
        <div asp-validation-summary="All"></div>

        <div class="btn-group btn-group-sm">
            <a href="@Url.RouteUrl("PrintOrderDetails", new { orderId = Model.Id })" target="_blank" class="btn btn-outline-secondary print-order-button">@T("Order.Print")</a>

            @if (!Model.PdfInvoiceDisabled)
            {
                <a href="@Url.RouteUrl("GetOrderPdfInvoice", new { orderId = Model.Id })" class="btn btn-outline-secondary pdf-invoice-button">@T("Order.GetPDFInvoice")</a>
            }

            @if (Model.ShowAddOrderNote)
            {
                <a href="@Url.RouteUrl("AddOrderNote", new { orderId = Model.Id })" class="btn btn-outline-secondary">@T("Order.AddOrderNote")</a>
            }
        </div>
    }

    @if (Model.UserCanCancelUnpaidOrder)
    {
        <a href="@Url.RouteUrl("CancelOrder", new { orderId = Model.Id })" class="btn btn-danger btn-sm cancel-unpaid-order-button float-right" onclick="return confirm('@T("Admin.Common.AreYouSure")');">@T("Order.CancelOrder")</a>
    }
    @await Component.InvokeAsync("Widget", new { widgetZone = "orderdetails_page_top", additionalData = Model.Id })
    <div class="order-overview generalMarginSupporter">
        <h5 class="order-number">
            <strong>@T("Order.Order#")@Model.OrderNumber</strong>
        </h5>
        @if (!string.IsNullOrEmpty(Model.OrderCode))
        {
            <div class="order-code">
                @T("Order.OrderCode"): @Model.OrderCode
            </div>
        }
        <div class="order-date">
            @T("Order.OrderDate"): @Model.CreatedOn.ToString("D")
        </div>
        <div class="order-status">
            @T("Order.OrderStatus"): @Model.OrderStatus
        </div>
        <div class="order-total">
            @T("Order.OrderTotal"): <strong>@Model.OrderTotal</strong>
        </div>
        @await Component.InvokeAsync("Widget", new { widgetZone = "orderdetails_page_overview", additionalData = Model.Id })
    </div>

    <div class="order-details-area">
        <b-card no-header no-footer>
            <b-form-row>
                <b-col sm="6" cols="12" class="billing">
                    <ul class="billing-info px-0">
                        <li class="title">
                            <h5 class="generalTitle">@T("Order.BillingAddress")</h5>
                        </li>
                        <li class="name">
                            @Model.BillingAddress.FirstName @Model.BillingAddress.LastName
                        </li>
                        <li class="email">
                            @T("Order.Email"): @Model.BillingAddress.Email
                        </li>
                        @if (Model.BillingAddress.PhoneEnabled)
                        {
                            <li class="phone">
                                @T("Order.Phone"): @Model.BillingAddress.PhoneNumber
                            </li>
                        }
                        @if (Model.BillingAddress.FaxEnabled)
                        {
                            <li class="fax">
                                @T("Order.Fax"): @Model.BillingAddress.FaxNumber
                            </li>
                        }
                        @if (Model.BillingAddress.CompanyEnabled && !String.IsNullOrEmpty(Model.BillingAddress.Company))
                        {
                            <li class="company">
                                @Model.BillingAddress.Company
                            </li>
                        }
                        @if (Model.BillingAddress.VatNumberEnabled && !String.IsNullOrEmpty(Model.BillingAddress.VatNumber))
                        {
                            <li class="company">
                                @Model.BillingAddress.VatNumber
                            </li>
                        }
                        @if (Model.BillingAddress.StreetAddressEnabled)
                        {
                            <li class="address1">
                                @Model.BillingAddress.Address1
                            </li>
                        }
                        @if (Model.BillingAddress.StreetAddress2Enabled && !String.IsNullOrEmpty(Model.BillingAddress.Address2))
                        {
                            <li class="address2">
                                @Model.BillingAddress.Address2
                            </li>
                        }
                        @if (Model.BillingAddress.CityEnabled ||
                            Model.BillingAddress.StateProvinceEnabled ||
                            Model.BillingAddress.ZipPostalCodeEnabled)
                        {
                            <li class="city-state-zip">
                                @if (Model.BillingAddress.CityEnabled)
                                {
                                    @Model.BillingAddress.City
                                }
                                @if (Model.BillingAddress.CityEnabled && (Model.BillingAddress.StateProvinceEnabled || Model.BillingAddress.ZipPostalCodeEnabled))
                                {
                                    <text>,</text>
                                }
                                @if (Model.BillingAddress.StateProvinceEnabled)
                                {
                                    @Model.BillingAddress.StateProvinceName
                                }
                                @if (Model.BillingAddress.ZipPostalCodeEnabled)
                                {
                                    @Model.BillingAddress.ZipPostalCode
                                }
                            </li>
                        }
                        @if (Model.BillingAddress.CountryEnabled && !String.IsNullOrEmpty(Model.BillingAddress.CountryName))
                        {
                            <li class="country">
                                @Model.BillingAddress.CountryName
                            </li>
                        }
                        @if (!String.IsNullOrEmpty(Model.VatNumber))
                        {
                            <li class="vat">
                                <span class="label">
                                    @T("Order.VATNumber")
                                </span>
                                <span class="value">
                                    @Model.VatNumber
                                </span>
                            </li>
                        }
                        @if (!String.IsNullOrEmpty(Model.BillingAddress.FormattedCustomAddressAttributes))
                        {
                            <li class="custom-attributes-view">
                                @Html.Raw(Model.BillingAddress.FormattedCustomAddressAttributes)
                            </li>
                        }
                        @if (!String.IsNullOrEmpty(Model.PaymentMethod))
                        {
                            <li class="title">
                                <h5 class="generalMarginSupporter generalTitle">@T("Order.Payment")</h5>
                            </li>
                            <li class="payment-method">
                                <span class="label">
                                    @T("Order.Payment.Method"):
                                </span>
                                <span class="value">
                                    @Model.PaymentMethod
                                </span>
                            </li>
                            if (!Model.PrintMode)
                            {
                                <li class="payment-method-status">
                                    <span class="label">
                                        @T("Order.Payment.Status"):
                                    </span>
                                    <span class="value">
                                        @Model.PaymentMethodStatus
                                    </span>
                                </li>
                            }
                            if (!Model.PrintMode && Model.CanRePostProcessPayment)
                            {
                                @*Complete payment (for redirection payment methods)*@
                                <li class="repost">
                                    <form asp-route="OrderDetails" method="post">
                                        <input type="submit" name="repost-payment" value="@T("Order.RetryPayment")" class="btn btn-secondary re-order-button" />
                                        <p class="hint">
                                            <em>@T("Order.RetryPayment.Hint")</em>
                                        </p>
                                    </form>
                                </li>
                            }
                        }
                        @if (Model.CustomValues != null)
                        {
                            foreach (var item in Model.CustomValues)
                            {
                                <li class="custom-value">
                                    <span class="label">
                                        @item.Key:
                                    </span>
                                    <span class="value">
                                        @(item.Value != null ? item.Value.ToString() : "")
                                    </span>
                                </li>
                            }
                        }
                    </ul>
                </b-col>
                @if (Model.IsShippable)
                {
                    <b-col sm="6" cols="12" class="shipping">
                        <ul class="shipping-info px-0">
                            <li class="title">
                                <h5 class="generalTitle">@(Model.PickUpInStore ? T("Order.PickupAddress") : T("Order.ShippingAddress"))</h5>
                            </li>
                            @if (!Model.PickUpInStore)
                            {
                                <li class="name">
                                    @Model.ShippingAddress.FirstName @Model.ShippingAddress.LastName
                                </li>
                                <li class="email">
                                    @T("Order.Email"): @Model.ShippingAddress.Email
                                </li>
                                if (Model.ShippingAddress.PhoneEnabled)
                                {
                                    <li class="phone">
                                        @T("Order.Phone"): @Model.ShippingAddress.PhoneNumber
                                    </li>
                                }
                                if (Model.ShippingAddress.FaxEnabled)
                                {
                                    <li class="fax">
                                        @T("Order.Fax"): @Model.ShippingAddress.FaxNumber
                                    </li>
                                }
                                if (Model.ShippingAddress.CompanyEnabled && !String.IsNullOrEmpty(Model.ShippingAddress.Company))
                                {
                                    <li class="company">
                                        @Model.ShippingAddress.Company
                                    </li>
                                }
                                if (Model.ShippingAddress.StreetAddressEnabled)
                                {
                                    <li class="address1">
                                        @Model.ShippingAddress.Address1
                                    </li>
                                }
                                if (Model.ShippingAddress.StreetAddress2Enabled && !String.IsNullOrEmpty(Model.ShippingAddress.Address2))
                                {
                                    <li class="address2">
                                        @Model.ShippingAddress.Address2
                                    </li>
                                }
                                if (Model.ShippingAddress.CityEnabled ||
                                    Model.ShippingAddress.StateProvinceEnabled ||
                                    Model.ShippingAddress.ZipPostalCodeEnabled)
                                {
                                    <li class="city-state-zip">
                                        @if (Model.ShippingAddress.CityEnabled)
                                        {
                                            @Model.ShippingAddress.City
                                        }
                                        @if (Model.ShippingAddress.CityEnabled && (Model.ShippingAddress.StateProvinceEnabled || Model.ShippingAddress.ZipPostalCodeEnabled))
                                        {
                                            <text>,</text>
                                        }
                                        @if (Model.ShippingAddress.StateProvinceEnabled)
                                        {
                                            @Model.ShippingAddress.StateProvinceName
                                        }
                                        @if (Model.ShippingAddress.ZipPostalCodeEnabled)
                                        {
                                            @Model.ShippingAddress.ZipPostalCode
                                        }
                                    </li>
                                }
                                if (Model.ShippingAddress.CountryEnabled && !String.IsNullOrEmpty(Model.ShippingAddress.CountryName))
                                {
                                    <li class="country">
                                        @Model.ShippingAddress.CountryName
                                    </li>
                                }
                                if (!String.IsNullOrEmpty(Model.ShippingAddress.FormattedCustomAddressAttributes))
                                {
                                    <li class="custom-attributes-view">
                                        @Html.Raw(Model.ShippingAddress.FormattedCustomAddressAttributes)
                                    </li>
                                }
                            }
                            else
                            {
                                if (!string.IsNullOrEmpty(Model.PickupAddress.Address1))
                                {
                                    <li class="address1">
                                        @Model.PickupAddress.Address1
                                    </li>
                                }
                                if (!string.IsNullOrEmpty(Model.PickupAddress.City) || !string.IsNullOrEmpty(Model.PickupAddress.ZipPostalCode))
                                {
                                    <li class="city-state-zip">
                                        @if (!string.IsNullOrEmpty(Model.PickupAddress.City))
                                        {
                                            @Model.PickupAddress.City
                                        }
                                        @if (!string.IsNullOrEmpty(Model.PickupAddress.ZipPostalCode))
                                        {
                                            <text>,</text>
                                            @Model.PickupAddress.ZipPostalCode
                                        }
                                    </li>
                                }
                                if (!string.IsNullOrEmpty(Model.PickupAddress.CountryName))
                                {
                                    <li class="country">
                                        @Model.PickupAddress.CountryName
                                    </li>
                                }
                            }
                            <li class="title">
                                <h5 class="generalMarginSupporter generalTitle">@T("Order.Shipping")</h5>
                            </li>
                            <li class="shipping-method">
                                <span class="label">
                                    @T("Order.Shipping.Name"):
                                </span>
                                <span class="value">
                                    @Model.ShippingMethod
                                </span>
                                @if (!string.IsNullOrEmpty(Model.ShippingAdditionDescription))
                                {
                                    <div> @Html.Raw(Model.ShippingAdditionDescription)</div>
                                }

                            </li>
                            @if (!Model.PrintMode && !Model.PickUpInStore)
                            {
                                <li class="shipping-status">
                                    <span class="label">
                                        @T("Order.Shipping.Status"):
                                    </span>
                                    <span class="value">
                                        @Model.ShippingStatus
                                    </span>
                                </li>
                            }
                        </ul>
                    </b-col>
                }
            </b-form-row>
        </b-card>
    </div>

    @if (Model.Items.Any())
    {
        @await Component.InvokeAsync("Widget", new { widgetZone = "orderdetails_page_beforeproducts", additionalData = Model.Id })
        <div class="products">
            <h5 class="generalTitle">@T("Order.Product(s)")</h5>
            <div class="mt-1">
                <div class="shopping-cart-container">
                    <div id="order-details"></div>
                    <script>
                            var OrderDetails = Vue.extend({
                                    template: '<b-table :fields="fields" :items="items" class="shopping-cart"> <template v-slot:cell(picture)="data"> <div v-html="data.value.picture"></div></template> <template v-slot:cell(product)="data"> <div v-html="data.value.product"></div></template> <template v-slot:cell(unitprice)="data"> <div v-html="data.value.unitprice"></div></template> <template v-slot:cell(quantity)="data"> <div v-html="data.value.quantity"></div></template> <template v-slot:cell(subtotal)="data"> <div v-html="data.value.subtotal"></div></template> </b-table>',
                                    data: function () {
                                    return {
                                         fields: [
                                            { key: 'picture', label: '@T("Order.Product(s).Picture")', class: 'text-center' },
                                            { key: 'product', label: '@T("Order.Product(s).Name")', class: 'text-center' },
                                            { key: 'unitprice', label: '@T("Order.Product(s).Price")', class: 'text-center'  },
                                            { key: 'quantity', label: '@T("Order.Product(s).Quantity")',  class: 'text-center' },
                                            { key: 'subtotal', label: '@T("Order.Product(s).Total")', class: 'text-center' },
                                        ],
                                        items: [
                                             @foreach (var item in Model.Items)
                                             {
                                             <text>
                                             {
                                                picture: {
                                                     picture: '<a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })"><img alt="@item.Picture.AlternateText" src="@item.Picture.ImageUrl" title="@item.Picture.Title" /></a>'
                                                },
                                                product: {
                                                    product: '@if (!Model.PrintMode){<em><a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })">@item.ProductName</a></em>}else{@item.ProductName}@if (Model.ShowSku){<div class="sku w-100 text-center text-md-left">@item.Sku</div>}@if (!string.IsNullOrEmpty(item.AttributeInfo)){<div class="attributes">@Html.Raw(item.AttributeInfo)</div>}@if (!string.IsNullOrEmpty(item.RentalInfo)){<div class="rental-info">@Html.Raw(item.RentalInfo)</div>}@if (!String.IsNullOrEmpty(item.DownloadId)){<div class="download"><a href="@Url.RouteUrl("GetDownload", new { orderItemId = item.OrderItemGuid })">@T("DownloadableProducts.Fields.Download")</a></div>}@if (!String.IsNullOrEmpty(item.LicenseId)){<div class="download license"><a href="@Url.RouteUrl("GetLicense", new {orderItemId = item.OrderItemGuid})">@T("DownloadableProducts.Fields.DownloadLicense")</a></div>}@await Component.InvokeAsync("Widget", new { widgetZone = "orderdetails_product_line", additionalData = item.Id })'
                                                },
                                                unitprice: {
                                                    unitprice: '<span class="product-unit-price price">@item.UnitPrice</span>@if (item.UnitPriceWithoutDiscountValue != item.UnitPriceValue && item.UnitPriceWithoutDiscountValue > 0){<div class="text-center"><del class="small text-danger">(@item.UnitPriceWithoutDiscount)</del></div>}'
                                                },
                                                quantity: {
                                                    quantity: '<span class="d-inline-block d-xl-none mr-1">@T("shoppingcart.quantity"):</span> @item.Quantity',
                                                },
                                                subtotal: {
                                                    subtotal: '<span class="product-subtotal price prod-total">@item.SubTotal</span>@if (!string.IsNullOrEmpty(item.Discount)) {<div class="discount text-success text-center"><span>@T("ShoppingCart.Discount"): </span><span>@item.Discount</span></div>}',
                                                }
                                             },
                                            </text>
                                            }
                                                ]
                                    }
                                }
                            })
                        new OrderDetails().$mount('#order-details')
                    </script>
                </div>
            </div>
        </div>
        @await Component.InvokeAsync("Widget", new { widgetZone = "orderdetails_page_afterproducts", additionalData = Model.Id })
        <div class="row">
            <div class="col-12 text-right options">
                @if (Model.Items.Any() && Model.DisplayTaxShippingInfo)
                {
                    var inclTax = Model.PricesIncludeTax;
                    <div class="tax-shipping-info">
                        @T(inclTax ? "Order.TaxShipping.InclTax" : "Order.TaxShipping.ExclTax", Url.RouteUrl("Topic", new { SeName = TopicSeNameConstants.Shippinginfo }))
                    </div>
                }
                @if (!String.IsNullOrEmpty(Model.CheckoutAttributeInfo))
                {
                    <div class="selected-checkout-attributes">
                        @Html.Raw(Model.CheckoutAttributeInfo)
                    </div>
                }
                @if (!Model.PrintMode)
                {
                    <div class="actions mb-3">
                        @if (Model.IsReOrderAllowed)
                        {
                            <input type="button" value="@T("Order.Reorder")" class="btn btn-outline-info re-order-button" onclick="location = ('@Url.RouteUrl("ReOrder", new { orderId = Model.Id })    ')" />
                        }
                        @if (Model.IsReturnRequestAllowed)
                        {
                            <input type="button" value="@T("Order.ReturnItems")" class="btn btn-outline-info return-items-button" onclick="location = ('@Url.RouteUrl("ReturnRequest", new { orderId = Model.Id })    ')" />
                        }
                    </div>
                }
            </div>
        </div>
        <div class="row">
            <div class="totals col-sm-12 col-md-6 ml-auto">
                <div class="table-responsive">
                    <table class="table table-hover">
                        <tbody>
                            <tr>
                                <td class="cart-total-left">
                                    <label>@T("Order.SubTotal"):</label>
                                </td>
                                <td class="cart-total-right text-right">
                                    <span>@Model.OrderSubtotal</span>
                                </td>
                            </tr>
                            @if (!string.IsNullOrEmpty(Model.OrderSubTotalDiscount))
                            {
                                <tr>
                                    <td class="cart-total-left">
                                        <label>@T("Order.SubTotalDiscount"):</label>
                                    </td>
                                    <td class="cart-total-right text-right">
                                        <span>@Model.OrderSubTotalDiscount</span>
                                    </td>
                                </tr>
                            }
                            @if (Model.IsShippable)
                            {
                                <tr>
                                    <td class="cart-total-left">
                                        <label>@T("Order.Shipping"):</label>
                                    </td>
                                    <td class="cart-total-right text-right">
                                        <span>@Model.OrderShipping</span>
                                    </td>
                                </tr>
                            }
                            @if (!string.IsNullOrEmpty(Model.PaymentMethodAdditionalFee))
                            {
                                <tr>
                                    <td class="cart-total-left">
                                        <label>@T("Order.PaymentMethodAdditionalFee"):</label>
                                    </td>
                                    <td class="cart-total-right text-right">
                                        <span>@Model.PaymentMethodAdditionalFee</span>
                                    </td>
                                </tr>
                            }
                            @if (Model.DisplayTaxRates && Model.TaxRates.Any())
                            {
                                foreach (var taxRate in Model.TaxRates)
                                {
                                    <tr>
                                        <td class="cart-total-left">
                                            <label>@string.Format(T("Order.TaxRateLine").Text, taxRate.Rate):</label>
                                        </td>
                                        <td class="cart-total-right text-right">
                                            <span>@taxRate.Value</span>
                                        </td>
                                    </tr>
                                }
                            }
                            @if (Model.DisplayTax)
                            {
                                <tr>
                                    <td class="cart-total-left">
                                        <label>@T("Order.Tax"):</label>
                                    </td>
                                    <td class="cart-total-right text-right">
                                        <span>@Model.Tax</span>
                                    </td>
                                </tr>
                            }
                            @if (!string.IsNullOrEmpty(Model.OrderTotalDiscount))
                            {
                                <tr>
                                    <td class="cart-total-left">
                                        <label>@T("Order.TotalDiscount"):</label>
                                    </td>
                                    <td class="cart-total-right text-right">
                                        <span>@Model.OrderTotalDiscount</span>
                                    </td>
                                </tr>
                            }
                            @if (Model.GiftCards.Any())
                            {
                                foreach (var gc in Model.GiftCards)
                                {
                                    <tr>
                                        <td class="cart-total-left">
                                            <label>@string.Format(T("Order.GiftCardInfo").Text, gc.CouponCode):</label>
                                        </td>
                                        <td class="cart-total-right text-right">
                                            <span>@gc.Amount</span>
                                        </td>
                                    </tr>
                                }
                            }
                            @if (Model.RedeemedRewardPoints > 0)
                            {
                                <tr>
                                    <td class="cart-total-left">
                                        <label>@string.Format(T("Order.RewardPoints").Text, Model.RedeemedRewardPoints):</label>
                                    </td>
                                    <td class="cart-total-right text-right">
                                        <span>@Model.RedeemedRewardPointsAmount</span>
                                    </td>
                                </tr>
                            }
                            <tr>
                                <td class="cart-total-left">
                                    <label>@T("Order.OrderTotal"):</label>
                                </td>
                                <td class="cart-total-right text-right">
                                    <span><strong>@Model.OrderTotal</strong></span>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    }
    else
    {
        <script>var mix = {}</script>
    }
    @if (!Model.PrintMode)
    {
        if (Model.Shipments.Any())
        {
            <div class="shipments px-0">
                <h5><strong>@T("Order.Shipments")</strong></h5>
                <div class="col-12 px-1">
                    <table class="table table-hover">
                        <colgroup>
                            <col />
                        </colgroup>
                        <thead class="table-inverse">
                            <tr>
                                <th>
                                    <div class="row">
                                        <div class="shipment-id col-md-2 col-sm-12">
                                            @T("Order.Shipments.ID")
                                        </div>
                                        <div class="tracking-number col-sm-2 d-none d-md-block">
                                            @T("Order.Shipments.TrackingNumber")
                                        </div>
                                        <div class="shipping-date col-sm-3 d-none d-md-block">
                                            @T("Order.Shipments.ShippedDate")
                                        </div>
                                        <div class="delivery-date col-sm-3 d-none d-md-block">
                                            @T("Order.Shipments.DeliveryDate")
                                        </div>
                                        <div class="view-details col-sm-2 d-none d-md-block">
                                            @T("Order.Shipments.ViewDetails")
                                        </div>
                                    </div>
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (var item in Model.Shipments)
                            {
                                <tr>
                                    <td>
                                        <div class="row">
                                            <div class="shipment-id col-md-2 col-sm-12">
                                                <strong class="d-lg-none">@T("Order.Shipments.ID"): </strong>
                                                <span>@item.ShipmentNumber.ToString()</span>
                                            </div>
                                            <div class="tracking-number col-md-2 col-sm-12">
                                                <strong class="d-lg-none">@T("Order.Shipments.TrackingNumber"): </strong>
                                                @item.TrackingNumber
                                            </div>
                                            <div class="shipped-date col-md-3 col-sm-12">
                                                @if (item.ShippedDate.HasValue)
                                                {
                                                    <strong class="d-lg-none">@T("Order.Shipments.ShippedDate"): </strong>
                                                    <span>@item.ShippedDate.Value.ToString("D")</span>
                                                }
                                                else
                                                {
                                                    <strong class="d-lg-none">@T("Order.Shipments.ShippedDate"): </strong>
                                                    <span>@T("Order.Shipments.ShippedDate.NotYet")</span>
                                                }
                                            </div>
                                            <div class="delivery-date col-md-3 col-sm-12">
                                                @if (item.DeliveryDate.HasValue)
                                                {
                                                    <strong class="d-lg-none">@T("Order.Shipments.DeliveryDate"): </strong>
                                                    <span>@item.DeliveryDate.Value.ToString("D")</span>
                                                }
                                                else
                                                {
                                                    <span class="d-lg-none">@T("Order.Shipments.ViewDetails")</span>
                                                    <span>@T("Order.Shipments.DeliveryDate.NotYet")</span>
                                                }
                                            </div>
                                            <div class="view-details col-md-2 col-sm-12">
                                                <a class="btn btn-sm btn-secondary" href="@Url.RouteUrl("ShipmentDetails", new { shipmentId = item.Id })" title="@T("Order.Shipments.ViewDetails")">@T("Order.Shipments.ViewDetails")</a>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
            </div>
        }
    }
    @if (!Model.PrintMode)
    {
        if (Model.OrderNotes.Any())
        {
            <div class="order-notes">
                <h5>
                    @T("Order.Notes")
                </h5>
                <div class="table-responsive">
                    <table class="table table-hover data-table">
                        <colgroup>
                            <col />
                            <col />
                        </colgroup>
                        <thead class="table-inverse">
                            <tr class="row mx-0">
                                <th class="created-on col-4">
                                    @T("Order.Notes.CreatedOn")
                                </th>
                                <th class="note col-8">
                                    @T("Order.Notes.Note")
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (var item in Model.OrderNotes)
                            {
                                <tr class="row mx-0">
                                    <td class="created-on col-4">
                                        @item.CreatedOn.ToString()
                                    </td>
                                    <td class="note col-8">
                                        @Html.Raw(item.Note)
                                        @if (item.HasDownload)
                                        {
                                            <p class="download">
                                                <a href="@Url.RouteUrl("GetOrderNoteFile", new { ordernoteid = item.Id })">@T("Order.Notes.Download")</a>
                                            </p>
                                        }
                                    </td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
            </div>
        }
    }
    @await Component.InvokeAsync("Widget", new { widgetZone = "orderdetails_page_bottom", additionalData = Model.Id })
</div>